//
//  LGPatientGroupCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/3/3.
//  我的分组

#import "LGPatientGroupCell.h"

@interface LGPatientGroupCell()
/**   */
@property (nonatomic , strong)UIView *baseView;

@end

@implementation LGPatientGroupCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.clipsToBounds = YES;
        self.contentView.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
        [self.contentView addSubview:self.baseView];
        [self.contentView addSubview:self.selectBtn];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.lineView];
        [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.right.equalTo(self.contentView).offset(-viewPix(16));
            make.left.bottom.equalTo(self.contentView).offset(viewPix(16));
        }];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.selectBtn.mas_right).offset(viewPix(16));
            make.right.equalTo(self.contentView).offset(-viewPix(32));
            make.centerY.equalTo(self.contentView);
        }];
        [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(viewPix(32));
            make.right.equalTo(self.contentView).offset(-viewPix(32));
            make.bottom.equalTo(self.contentView);
            make.height.equalTo(@(0.5));
        }];
    }
    return  self;
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:15];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIButton *)selectBtn{
    if(!_selectBtn){
        _selectBtn = [UIButton buttonWithImage:@"unselect20" selectImage:@"selected20"];
        _selectBtn.frame = CGRectMake(viewPix(32), viewPix(16), viewPix(24), viewPix(24));
        _selectBtn.userInteractionEnabled = NO;
    }
    return _selectBtn;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:2];
    }
    return _titleLabel;
}

-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = [UIColor colorWithString:@"#E1E1E1"];
    }
    return _lineView;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
